{% extends 'QuestionPlusBundle:QuestionPlumber:layout.html.twig' %}

{% set side_nav = 'question_plumber' %}
{% set script_controller = 'questionplusbundle/controller/question-plumber/import' %}

{% block type %}

{% if not questionPlusSetting.enabled %}
  <div class="empty">导入功能未开启</div>
{% else %}

<style>
  .testpaper-question-seq-wrap {
    width: 80px;
  }
  .testpaper-question-choices {
    margin-left: 90px;
  }

  .testpaper-question-result {
    margin-left: 90px;
  }

  .testpaper-question-analysis {
    margin-left: 90px;
    
  }

</style>

  <form class="form-horizontal" id="question-import-form" method="post" action="{{ path('course_question_plumber', {courseId:course.id, type:'import'}) }}" enctype="multipart/form-data">

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="type">导入格式</label>
      </div>
      <div class="col-md-8 controls">
        <div class="radio">
          <label>
            <!-- <input type="radio" name="type" value="mix" checked> -->
            混合模式（一道题一个答案） <a class="pull-right" href="{{ asset('bundles/questionplus/mix.txt') }}" target="_blank">查看示例说明</a>
          </label>
        </div>
       <!--  <div class="radio">
          <label>
            <input type="radio" name="type" value="block">
            分段模式（题目和答案分离） <a class="pull-right" href="{{ asset(examples.block) }}">查看示例说明</a>
          </label>
        </div> -->
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="file">要导入的文件</label>
      </div>
      <div class="col-md-8 controls">
        <input type="file" id="import-file" name="importFile" accept="text/plain">
        <p class="help-block">支持从文本文件导入</p>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="type">选择导入范围</label>
      </div>
      <div class="col-md-8 controls">
        <select class="form-control width-input width-input-large" id="import-target" name="target" data-role="target">
          {{ select_options(targetsChoices) }}
        </select>
        <div class="help-block">可以导入本课程或者某个课时的题目</div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-offset-2 col-md-8 controls">
        <button class="btn btn-fat btn-primary" data-reading-text="正在读取..." data-readed-text="读取完成" data-error-text="读取失败,请检查格式" id="question-import-btn" type="submit">读取</button>
      </div>
    </div>

  </form>

  <div id="questions-show-board"></div>

{% endif %}

{% endblock %}

